package com.yesun.task.pipeline.service.impl;

import com.yesun.task.pipeline.config.ClickhouseDb;
import com.yesun.task.pipeline.domain.po.DetailPO;
import com.yesun.task.pipeline.domain.po.NewsPO;
import com.yesun.task.pipeline.mapper.ClickhouseMapper;
import com.yesun.task.pipeline.service.ClickhouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ClickhouseServiceImpl implements ClickhouseService {

    @Autowired
    private ClickhouseMapper clickhouseMapper;

    //表示执行clickhouse数据源
    @ClickhouseDb
    @Override
    public List<Map<String, Object>> query(String sql) {
        return clickhouseMapper.query(sql);
    }

    @ClickhouseDb
    @Override
    public void batchInsert(List<DetailPO> list) {
        clickhouseMapper.batchInsert(list);
    }


    @ClickhouseDb
    @Override
    public void batchInsertNews(List<NewsPO> list) {
        clickhouseMapper.batchInsertNews(list);
    }
}
